﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ShootSearch.Runner.Controls;
using System.Diagnostics;

namespace ShootSearch.Runner
{
    public partial class FormMain : Form
    {
        FormMainControl control = null;

        public FormMain()
        {
            InitializeComponent();
            control = new FormMainControl(this);
            
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            listViewTasks.Items.Clear();
            control.LoadTasks();

        }

        private void tsButtonNewTask_Click(object sender, EventArgs e)
        {
            control.Task_New();
        }

        private void tsButtonRun_Click(object sender, EventArgs e)
        {
            control.Task_Run();
        }

        private void tsButtonStop_Click(object sender, EventArgs e)
        {
            control.Task_Stop();
        }

        private void listViewTasks_Click(object sender, EventArgs e)
        {         
            
        }

        private void tsmiTasksOpen_Click(object sender, EventArgs e)
        {
            control.Task_OpenPath();
        }

        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
            Hide();
        }

        private void FormMain_VisibleChanged(object sender, EventArgs e)
        {
            control.Form_Visibility_Changed();
        }

        private void tsmiIconSysHide_Click(object sender, EventArgs e)
        {
            control.ChangeHideShow();
        }

        private void notifyIconSys_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            control.ChangeHideShow();
        }

        private void tsmiIconSysExit_Click(object sender, EventArgs e)
        {
            control.Exit();
        }

        private void tsButtonEdit_Click(object sender, EventArgs e)
        {
            control.Task_Edit();
        }

        private void tsmiTasksReload_Click(object sender, EventArgs e)
        {
            control.Task_Reload();
        }

        private void timerUpdateTask_Tick(object sender, EventArgs e)
        {
            control.Timer_ShowTaskStatus();
        }

        private void splitContainerMain_SplitterMoved(object sender, SplitterEventArgs e)
        {
            if (listViewTasks.TileSize.Height > 0)
                listViewTasks.TileSize = new Size(splitContainerMain.Panel1.Width-30,
                            listViewTasks.TileSize.Height);            
        }


        private void tsButtonDelete_Click(object sender, EventArgs e)
        {
            control.Task_Delete();
        }

        private void listViewTasks_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            control.ButtonActivate();
        }


        private void tsmiButtonOpen_Click(object sender, EventArgs e)
        {
            control.Task_OpenImport(true);

        }

        private void tsmiButtonImport_Click(object sender, EventArgs e)
        {
            control.Task_OpenImport(false);

        }






    }
}
